//
//  DDHomeViewController.m
//  QMUIKitDemo
//
//  Created by Dxc_iOS on 2018/7/18.
//  Copyright © 2018年 Dxc_123. All rights reserved.
//

#import "DDHomeViewController.h"

@interface DDHomeViewController ()
@property(nonatomic, strong) QMUIButton *normalButton;
@property(nonatomic, strong) QMUIButton *imagePositionButton1;
@property(nonatomic, strong) QMUIButton *imagePositionButton2;
@end

@implementation DDHomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self textUIButton];
    
}
-(void)textUIButton{
    self.normalButton = [QMUIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:self.normalButton];
    self.normalButton.frame = CGRectMake(100, 100, 100, 45);
    [self.normalButton setTitle:@"按钮1" forState:UIControlStateNormal];
    self.normalButton.backgroundColor = [UIColor redColor];
    [self.normalButton addTarget:self action:@selector(btnClicked1) forControlEvents:UIControlEventTouchUpInside];
    
    
    // 图片+文字按钮
    self.imagePositionButton1 = [[QMUIButton alloc] init];
    self.imagePositionButton1.frame = CGRectMake(100, 200, 100, 50);
    self.imagePositionButton1.imagePosition = QMUIButtonImagePositionTop;// 将图片位置改为在文字上方
    self.imagePositionButton1.spacingBetweenImageAndTitle = 8;
    [self.imagePositionButton1 setImage:UIImageMake(@"menu_all") forState:UIControlStateNormal];
    [self.imagePositionButton1 setTitle:@"图片在上方的按钮" forState:UIControlStateNormal];
    self.imagePositionButton1.titleLabel.font = UIFontMake(11);
    [self.imagePositionButton1 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.view addSubview:self.imagePositionButton1];
    
    self.imagePositionButton2 = [[QMUIButton alloc] init];
    self.imagePositionButton2.frame = CGRectMake(200, 200, 100, 50);
    self.imagePositionButton2.imagePosition = QMUIButtonImagePositionBottom;// 将图片位置改为在文字下方
    self.imagePositionButton2.spacingBetweenImageAndTitle = 8;
    [self.imagePositionButton2 setImage:UIImageMake(@"menu_all") forState:UIControlStateNormal];
    [self.imagePositionButton2 setTitle:@"图片在下方的按钮" forState:UIControlStateNormal];
    
    self.imagePositionButton2.titleLabel.font = UIFontMake(11);
    [self.view addSubview:self.imagePositionButton2];
    
}


-(void)btnClicked1{
/**
 QMUIAlertAction *action1 = [QMUIAlertAction actionWithTitle:@"取消" style:QMUIAlertActionStyleCancel handler:NULL];
 QMUIAlertAction *action2 = [QMUIAlertAction actionWithTitle:@"删除" style:QMUIAlertActionStyleDestructive handler:NULL];
 QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"确定删除？" message:@"删除后将无法恢复，请慎重考虑" preferredStyle:QMUIAlertControllerStyleAlert];
 [alertController addAction:action1];
 [alertController addAction:action2];
 [alertController showWithAnimated:YES];
 */
    
    
//     [QMUITips showInfo:@"iOS 版本过低，不支持 UIAlertController" inView:self.view hideAfterDelay:2];
    [QMUITips showError:@"错错错啦啦啦"];
//    [QMUITips showWithText:@"lalaalaalal"];
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
